Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image upload by url #1335

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

LewisYearsley
Copy link
Contributor

Description

The Cloudflare image API provides the ability to upload an image via a url, rather than as bytes. e.g. you might want to copy the image from some bucket to Cloudflare without having to manage the data yourself. This PR adds that functionality, heavily based on the existing file upload methodology.

Has your change been tested?

Added test in the same fashion as the file based upload method.

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented in cloudflare/api-schemas
    and relies on stable APIs.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 15, 2023

changelog detected ✅

@jacobbednarz
Copy link
Member

thanks for the PR here, appreciate it! for me though, i would rather see UploadImage with the ability to upload all images regardless of the method used. to get this over the line, let's update the methods here to conditionally build the payload (even if you need to use multiple internal methods) instead of the multiple methods which i believe is a better experience for anyone attempting to use this.

@LewisYearsley
Copy link
Contributor Author

No problem and for sure - I was actually in two minds about whether to have a combined signature! I’ll rework it today - thanks for looking.

@dojolew
Copy link
Contributor

dojolew commented Jul 17, 2023

@jacobbednarz handled your feedback - mind taking another look when you get time? 🙏

@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2023

Codecov Report

Merging #1335 (5a38e52) into master (b9ac804) will increase coverage by 0.09%.
The diff coverage is 60.08%.

@@            Coverage Diff             @@
##           master    #1335      +/-   ##
==========================================
+ Coverage   48.33%   48.43%   +0.09%     
==========================================
  Files         133      133              
  Lines       13023    13072      +49     
==========================================
+ Hits         6295     6331      +36     
- Misses       5201     5208       +7     
- Partials     1527     1533       +6     
Impacted Files Coverage Δ
logpush.go 51.81% <46.15%> (-0.30%) ⬇️
images.go 44.70% <47.82%> (-0.12%) ⬇️
rulesets.go 30.03% <52.17%> (-4.61%) ⬇️
pages_deployment.go 38.88% <61.76%> (+4.64%) ⬆️
pages_project.go 58.22% <90.00%> (+7.40%) ⬆️
access_policy.go 70.27% <100.00%> (ø)
pagination.go 100.00% <100.00%> (+28.57%) ⬆️

@jacobbednarz jacobbednarz merged commit ce65e08 into cloudflare:master Jul 18, 2023
@github-actions github-actions bot added this to the v0.73.0 milestone Jul 18, 2023
@jacobbednarz
Copy link
Member

thanks for this one! appreciate it 🙇

github-actions bot pushed a commit that referenced this pull request Jul 18, 2023
@LewisYearsley
Copy link
Contributor Author

Thanks @jacobbednarz! Any idea when this might be released?

@LewisYearsley LewisYearsley deleted the image-upload-by-url branch July 18, 2023 05:55
@jacobbednarz
Copy link
Member

@github-actions
Copy link
Contributor

This functionality has been released in v0.73.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants